package dev.loong.boot3.commons;

public enum SexEnum {
    MALE(1, "男"),
    FEMALE(2, "女");
    private Integer code;
    private String name;
    SexEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
    public Integer getCode() {
        return code;
    }
    public String getName() {
        return name;
    }
    public static SexEnum getSex(Integer code) {
        for (SexEnum sexEnum : SexEnum.values()) {
            if (sexEnum.getCode().equals(code)) {
                return sexEnum;
            }
        }
        return null;
    }
}
